﻿using BCEntity.Sim.Admin.AdminPermissionMappingPage;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Sim.Admin.AdminPermissionMappingPage
{
    /// <summary>
    /// 员工页面权限映射
    /// </summary>
    public interface IAdminPermissionMappingPageData
    {
        /// <summary>
        /// 检查员工权限页面映射是否存在
        /// </summary>
        /// <param name="pagePathCode">页面路径码</param>
        /// <returns></returns>
        Task<bool> CheckExists(string pagePathCode);
        /// <summary>
        /// 检查员工权限页面映射是否存在
        /// </summary>
        /// <param name="permissionCode">权限码</param>
        /// <returns></returns>
        Task<bool> CheckPermissionCodeExists(string permissionCode);
        /// <summary>
        /// 添加员工页面权限映射
        /// </summary>
        /// <param name="entity">员工页面权限映射</param>
        /// <returns></returns>
        Task<AdminPermissionMappingPageEntity> Add(AdminPermissionMappingPageEntity entity);
        /// <summary>
        /// 修改员工页面权限映射
        /// </summary>
        /// <param name="entity">目标员工页面权限映射</param>
        /// <returns></returns>
        Task<AdminPermissionMappingPageEntity> Update(AdminPermissionMappingPageEntity entity);
        /// <summary>
        /// 删除员工页面权限映射
        /// </summary>
        /// <param name="partnerPermissionMappingPageId">员工页面权限映射Id</param>
        void Delete(long partnerPermissionMappingPageId);
        /// <summary>
        /// 获取员工页面权限映射
        /// </summary>
        /// <param name="partnerPermissionMappingPageId">员工页面权限映射Id</param>
        /// <returns></returns>
        Task<AdminPermissionMappingPageEntity> GetEntity(long partnerPermissionMappingPageId);
        /// <summary>
        /// 获取员工页面权限映射列表（分页）
        /// </summary>
        /// <param name="permissionCode">权限编码</param>
        /// <param name="pathLevel">路径级别</param>
        /// <param name="parentPathCode">父级路径</param>
        /// <param name="fixedParentPathCode">固定父级路径编码查询</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <returns></returns>
        Task<(IEnumerable<AdminPermissionMappingPageEntity>, int)> Query(string permissionCode,string parentPathCode, bool fixedParentPathCode, int? pathLevel, int pageIndex = 1, int pageSize = 10);
        /// <summary>
        /// 获取员工页面权限映射列表
        /// </summary>
        /// <param name="permissionCode">权限编码</param>
        /// <returns></returns>
        Task<IEnumerable<AdminPermissionMappingPageEntity>> GetList(string permissionCode);
        /// <summary>
        /// 获取员工页面权限映射列表
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<StaffRolePermissionPageRecordEntity>> GetList(int? departmentId);
        /// <summary>
        /// 获取指定员工页面权限列表
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <returns></returns>
        Task<IEnumerable<StaffRolePermissionPageRecordEntity>> GetListByAdminIdAsync(long? adminId);
        /// <summary>
        /// 修改页面顺序
        /// </summary>
        /// <param name="entities">目标员工页面权限映射列表</param>
        /// <returns></returns>
        Task<bool> UpdatePageOrder(IEnumerable<AdminPermissionMappingPageEntity> entities);
        /// <summary>
        /// 获取最后一个根级别页面信息
        /// </summary>
        /// <returns></returns>
        Task<AdminPermissionMappingPageEntity> GetLastRootEntity();
        /// <summary>
        /// 获取相同父级页面码的最后一个页面信息
        /// </summary>
        /// <param name="parentPathCode">父级页面路径码</param>
        /// <returns></returns>
        Task<AdminPermissionMappingPageEntity> GetLastOrderEntityByParentPathCode(string parentPathCode);
    }
}
